/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import Controleur.Embarcadere;
import Controleur.Embarcation;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Valentin
 */
public class EmbarcationDAO extends DAO<Embarcation> {

    public EmbarcationDAO(Connection conn) {
        super(conn);
    }
    
    @Override
     public Map<Integer, Embarcation> findAll() throws SQLException {
        Map<Integer,Embarcation> myMap = new HashMap<>();
        String query = " SELECT *"
                + " FROM embarcation";

        queryResult = state.executeQuery(query);
        while (queryResult.next()) {
            Embarcation myEmbarcation = new Embarcation();
            myEmbarcation.setID(queryResult.getInt("IDEmbarcation"));
            myEmbarcation.setNom(queryResult.getString("nom"));
           
            myMap.put(myEmbarcation.getID(), myEmbarcation);
        }
        return myMap;
    }
}
